package idv.jamham.bmi;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.support.v4.app.NavUtils;

public class MainActivity extends Activity implements OnClickListener {

	View viewToAnimate;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        
        Button button = (Button)findViewById(R.id.toggleButton);
        button.setOnClickListener(this);
        
        viewToAnimate = findViewById(R.id.theView);
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        
        
        
        
        
        return true;
        
        
        
    }

    boolean toggle = true;
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
		
		
		toggle = !toggle;
		
		 if( toggle) {	// if(viewToAnimate.getVisibility() == View.VISIBLE) {
	            Animation out = AnimationUtils.makeOutAnimation(this, true);
	            viewToAnimate.startAnimation(out);
	            viewToAnimate.setVisibility(View.INVISIBLE);
	        } else {
	            Animation in = AnimationUtils.makeInAnimation(this, false);//, fromLeft).loadAnimation(this, android.R.anim.fade_in);
	            viewToAnimate.startAnimation(in);
	            viewToAnimate.setVisibility(View.VISIBLE);
	        }
		  
		  
		
	}

    
}
